package cn.tedu.evilboot.controller;

import cn.tedu.evilboot.mapper.LeaderMapper;
import cn.tedu.evilboot.pojo.entity.Leader;
import cn.tedu.evilboot.pojo.vo.LeaderVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/evil/leader")
public class LeaderController {
    @Autowired(required = false)
    LeaderMapper mapper;
    @RequestMapping("/select")
    public List<Leader> select(){
        return mapper.select();
    }
    @RequestMapping("/update")
    public void update(@RequestBody Leader leader){
        System.out.println("leader = " + leader);
        Leader l=new Leader();
        BeanUtils.copyProperties(leader,l);
        l.setId(1);


        mapper.update(leader);
    }

}
